﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Windows.Forms;
using System.Text;

namespace ANZ_AIM_DAL
{
    /// <summary>
    /// Singleton class to provide general settings/values for the application.
    /// This is a read-only class so it cannot be modified.
    /// All processs/threads will get the same settings/values.
    /// </summary>
    public sealed class AppParam
    {
        static AppParam instance = null;
        static readonly object padlock = new object();
     
        public string AppPath;
        public Dictionary<string, string> DBTableDict { get; set; }

        AppParam()
        {
            this.AppPath = Path.GetDirectoryName(Application.ExecutablePath);
              
            // dictionary for mapping between class name and table name (used for change logging in BaseController)
            this.DBTableDict = new Dictionary<string, string>();
            this.DBTableDict.Add("MasterData", "MasterData");

            //DB offline tool
            this.DBTableDict.Add("MailConfig", "MailConfig");
            this.DBTableDict.Add("EmploymentOffline", "EmploymentOffline");
            this.DBTableDict.Add("CandidateOffline", "CandidateOffline");
            this.DBTableDict.Add("EmploymentOfflineChangeTemp", "EmploymentOfflineChangeTemp");
            //end

            //DB AIM tool
            this.DBTableDict.Add("User", "Users");
            this.DBTableDict.Add("Configuration", "Configurations");

            this.DBTableDict.Add("Candidate", "Candidates");
            this.DBTableDict.Add("BatchFileUpload", "BatchFileUploads");
            this.DBTableDict.Add("SaleInfo", "SaleInfo");
            this.DBTableDict.Add("BatchFileChangeUpload", "BatchFileChangeUploads");     
            this.DBTableDict.Add("SaleChangeRequest", "SaleChangeRequest");

            this.DBTableDict.Add("BatchFileSaleInfoUpload", "BatchFileSaleInfoUploads");
            this.DBTableDict.Add("SalePIP", "SalePIP");
            this.DBTableDict.Add("SaleSQM", "SaleSQM");
            this.DBTableDict.Add("SaleSQMRawData", "SaleSQMRawData");
            this.DBTableDict.Add("SalePayment", "SalePayment");
            this.DBTableDict.Add("SaleDIS", "SaleDIS");
            this.DBTableDict.Add("AgentCards", "AgentCards");
            this.DBTableDict.Add("AgentCardsActivationRate", "AgentCardsActivationRate");
            this.DBTableDict.Add("AgentFieldSales", "AgentFieldSales");
            this.DBTableDict.Add("AgentLOC", "AgentLOC");
            this.DBTableDict.Add("AgentSuppCard", "AgentSuppCard");
            this.DBTableDict.Add("AgentPersonalLoan", "AgentPersonalLoan");
            this.DBTableDict.Add("TeamLeaderCards", "TeamLeaderCards");
            this.DBTableDict.Add("TeamLeaderFieldSales", "TeamLeaderFieldSales");
            this.DBTableDict.Add("TeamLeaderPL", "TeamLeaderPL");
            this.DBTableDict.Add("TeamLeaderPortfolio", "TeamLeaderPortfolio");
            this.DBTableDict.Add("MonthlyAgentList", "MonthlyAgentList");
            this.DBTableDict.Add("SaleAttendance", "SaleAttendance");
            this.DBTableDict.Add("SaleChangeTemp", "SaleChangeTemp");

            //end
        }

        public static AppParam Instance
        {
            get
            {
                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new AppParam();
                    }
                    return instance;
                }
            }
        }
    }
}
